/**
 * 定义天报表模块
 */
(function(window, angular, undefined){
	var module = angular.module('water.apps.zhuhai.reportData.dayDataManager', ['water.apps.common.report.reportFormBase',
	                                                                          'water.common.dateUtil']);
	
	module.controller('reportDataDayManagerController',function($scope,$zhuhaiMonitorDataService,$controller,$dateUtil){

		var control = $controller("commonReportFormController",{$scope:$scope});
		
		$scope.dataAPIName = 'getDayReport';
		$scope.dataExportAPIName = "exportDayExcel";
		$scope.stadardData={};
		var TwoTypeWaterStardard = {"065":'0.2~0.5(湖、库)',"060":'0.15~0.5',"ss_zhuodu":'',"101":'0.02~0.1',"111":'2~4',"001":'6~9',"cond":'',"do":'6~7.5',"phtem":''};
		var threeTypeWaterStardard = {"065":'0.5~1(湖、库)',"060":'0.5~1',"ss_zhuodu":'',"101":'0.1~0.2',"111":'4~6',"001":'6~9',"cond":'',"do":'5~6',"phtem":''};
		var fourTypeWaterStardard = {"065":'1~1.5(湖、库)',"060":'1~1.5',"ss_zhuodu":'',"101":'0.2~0.3',"111":'6~10',"001":'6~9',"cond":'',"do":'3~5',"phtem":''};
		$scope.stadardData.TwoTypeWaterStardard = TwoTypeWaterStardard;
		$scope.stadardData.threeTypeWaterStardard = threeTypeWaterStardard;
		$scope.stadardData.fourTypeWaterStardard = fourTypeWaterStardard;
		
		$scope.item = "项目";
		$scope.unit = "单位";
		$scope.Stadard_II = "地表水标准值Ⅱ类";
		$scope.Stadard_III = "地表水标准值Ⅲ类";
		$scope.Stadard_IV = "地表水标准值Ⅳ类";
		
		/**
		 * 站点选择后，报表查询前执行的逻辑
		 * 用于准备查询前的参数
		 */
		$scope.onStationSelectedBeforeQuery = function(station){
			$scope.selectedModel = station;
			var parmList = $scope.selectedModel.parmToCheckList;
			$scope.parmList = $scope.selectedModel.parmToCheckList;
		}
		
		function _init(){
			$scope.startDate = $dateUtil.formatDate(new Date(),'yyyy-MM-dd');
		}
		/**
		 *  导出excel
		 */
		$scope.onExportExcelClick = function(){
			var queryObj = $scope.getQueryObject(true);
			$zhuhaiMonitorDataService[$scope.dataExportAPIName](queryObj);
		}
		$scope.getReport = function(queryObject){
			$zhuhaiMonitorDataService[$scope.dataAPIName](queryObject).then(function(data){
				$scope.data = data;
			});
			$scope.onTBClick();
		}
		_init();
	});
}(window, angular));